package cn.iocoder.yudao.module.system.dal.mysql.price;


import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.module.system.controller.admin.price.vo.LivePriceConfPageReqVO;
import cn.iocoder.yudao.module.system.dal.dataobject.price.LivePriceConfDO;
import org.apache.ibatis.annotations.Mapper;

/**
 * 实时价格配置 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface LivePriceConfMapper extends BaseMapperX<LivePriceConfDO> {

    default PageResult<LivePriceConfDO> selectPage(LivePriceConfPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<LivePriceConfDO>()
                .eqIfPresent(LivePriceConfDO::getIncreasePrice, reqVO.getIncreasePrice())
                .eqIfPresent(LivePriceConfDO::getDecreasePrice, reqVO.getDecreasePrice())
                .eqIfPresent(LivePriceConfDO::getWaveIncreasePrice, reqVO.getWaveIncreasePrice())
                .eqIfPresent(LivePriceConfDO::getWaveDecreasePrice, reqVO.getWaveDecreasePrice())
                .eqIfPresent(LivePriceConfDO::getMetalType, reqVO.getMetalType())
                .eqIfPresent(LivePriceConfDO::getModuleType, reqVO.getModuleType())
                .eqIfPresent(LivePriceConfDO::getAlarmPrice, reqVO.getAlarmPrice())
                .eqIfPresent(LivePriceConfDO::getConfStatus, reqVO.getConfStatus())
                .betweenIfPresent(LivePriceConfDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(LivePriceConfDO::getId));
    }

}